import 'package:flutter/cupertino.dart';
import 'package:flutter_jpf_core/widgets/nodata/nodata_view.dart';

class ContainNodataView extends StatelessWidget{

  bool isShowNoData;
  Widget dataView;
  Widget nodataView;

  static Widget __comNodataView;

  static config({Widget nodataView}){
    __comNodataView = nodataView;
  }

  ContainNodataView(this.isShowNoData,this.dataView,{this.nodataView}){
    if(__comNodataView == null){
      __comNodataView = NoDataView();
    }
  }

  ContainNodataView.old(this.dataView,{this.nodataView,this.isShowNoData = false}){
    if(__comNodataView == null){
      __comNodataView = NoDataView();
    }
  }



  @override
  Widget build(BuildContext context) {
    if(!isShowNoData){
      return this.dataView;
    }
    return Stack(children: [
      Positioned(child: nodataView == null?__comNodataView:nodataView ),
      Positioned(child: this.dataView)
    ],);
  }

}